package com.wrxdz.start.surfaceviewt.activity;

import android.annotation.SuppressLint;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.Toast;

import com.wrxdz.start.surfaceviewt.R;

public class SurfaceViewTemplate extends AppCompatActivity {
    private com.wrxdz.start.surfaceviewt.surfview.SurfaceViewTemplate drawingBoard;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_surface_view_template);
        init();
        WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);

//        int width = wm.getDefaultDisplay().getWidth();
//        int height = wm.getDefaultDisplay().getHeight();
//        Toast.makeText(this,width+","+height,Toast.LENGTH_LONG).show();
    }

    public void init() {
        Button clear = findViewById(R.id.clear);
        drawingBoard = findViewById(R.id.drawing);
        clear.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                drawingBoard.reDraw();
            }
        });
    }

    @SuppressLint({"WrongConstant", "ShowToast"})
    @Override
    protected void onResume() {
        super.onResume();
        if (drawingBoard == null) {
            Toast.makeText(this, "null", 0).show();
        }
    }
}
